package com.superzlc.miniweb.controller;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.superzlc.miniweb.servlet.Model;
import com.superzlc.miniweb.servlet.anno.Controller;
import com.superzlc.miniweb.servlet.anno.QueryParam;
import com.superzlc.miniweb.servlet.anno.RequestMapping;

@Controller
@RequestMapping("/default")
public class DefaultController {

	@RequestMapping(value = "/default")
	public String action(@QueryParam("msg") String msg, Model model) {
		System.out.println(msg);
		msg = msg == null ? "NULL" : msg;
		model.addAttribute(
				"msg",
				"Message: "
						+ msg
						+ " "
						+ new SimpleDateFormat("yyyy/MM/dd HH:mm:ss")
								.format(new Date()));
		return "jsp/msg";
	}

}
